package cn.fintecher.gis.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;

@Data
@Table(name = "resource")
@Entity
@ApiModel(value = "resource", description = "资源管理")
public class Resource extends BaseEntity {

    @ApiModelProperty(notes = "资源名称")
    private String resourceName;

    @ApiModelProperty(notes = "描述")
    private String remark;

    @ApiModelProperty(notes = "图标")
    private String icon;

    @ApiModelProperty(notes = "排序")
    private Integer sort;

    @ApiModelProperty(notes = "类型")
    private Integer resourceType;

    @ApiModelProperty(notes = "路径")
    private String url;

    @ApiModelProperty("父功能")
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "parent_id")
    private Resource parent;

    @ApiModelProperty(notes = "是否展示 0 隐藏  1  展示")
    private Integer resourceShow;


    public enum Type {
        ONE_MENU(17, "一级菜单"),
        TWO_MENU(18, "二级菜单"),
        BUTTON(19, "控件");

        private Integer value;
        private String chinese;

        Type(Integer value, String chinese) {
            this.value = value;
            this.chinese = chinese;
        }

        public Integer getValue() {
            return value;
        }

        public String getChinese() {
            return chinese;
        }
    }


}
